package org.duang.event;

import org.duang.event.core.Event;
import org.duang.event.core.EventModel;

public class EventUtil {
	
	private static EventHandler handler;

	public static void init(EventHandler handler) {
		EventUtil.handler = handler;
	}

	/**
	 * 发布事件
	 * @param event Event
	 */
	public static void executeEvent(Event event) {
		EventUtil.handler.executeEvent(event);
	}
	
	/**
	 * 发布事件
	 * @param EventModel model
	 */
	@SuppressWarnings("unchecked")
	public static  <T> T executeEvent(EventModel model) {
		return (T)EventUtil.handler.executeEvent(model);
	}
}
